from selenium import webdriver
import time 
from selenium.webdriver.common.by import By
driver = webdriver.Chrome()
driver.get("http://www.so.com")
driver.find_element_by_link_text("360导航").click()
time.sleep(4)
window=driver.window_handles
driver.switch_to.window(window[1])
# 调用driver.window_handles切换到第二个窗口
time.sleep(2)
driver.find_element_by_id("search-kw").send_keys("周鸿祎")
time.sleep(3)
driver.switch_to_window(window[0])
#调用driver.switch_to_window()切换到第一个窗口
driver.find_element_by_id("input").send_keys("360浏览器")
